<template>
  <div>
    <div v-if="hasPermission('view_cardManagementView')">
      <div>...</div>
    </div>
  </div>
</template>

<script>
import { mapGetters } from "vuex";

export default {
  name: "CardManegementView",
  computed: {
    ...mapGetters("user", ["permissions"]), // 从 user 模块中获取 permissions
    hasPermission() {
      return (permission) => this.permissions.includes(permission);
    },
  },
  mounted() {
    // 在组件加载时检查权限
    if (!this.hasPermission("view_cardManagementView")) {
      // 如果没有权限，跳转到 403 页面
      this.$router.push("/Permissions403View");
    }
  },
};
</script>
